# import base64
#
# from Crypto.Cipher import AES
#
#
# def addStrToSpecifyLen(password, specifyLen=0):
#     """
#     # If the password is not a multiple of specifyLen, then it is made up to a multiple of specifyLen
#     :param password: Parameters that require encryption
#     :param specifyLen: Specifies the number of bits for the parameter
#     :return: Parameters that make up the number of digits
#     """
#     if specifyLen <= 0:
#         specifyLen = 1
#     while len(password) % specifyLen != 0:
#         password += '\0'
#     return password.encode(encoding='utf-8')
#
#
# def encrypt_aes(text, aes_key):
#     """
#     AES's ECB mode encryption
#     :param text: Encrypt data
#     :param aes_key: The encrypted key
#     :return: The ciphertext after encryption
#     """
#     # Initialize the cryptor
#     aes = AES.new(addStrToSpecifyLen(aes_key, 16), AES.MODE_ECB)
#     # AES encryption first
#     encrypt = aes.encrypt(addStrToSpecifyLen(text, 16))
#     # Use base64 to convert to string form
#     encrypted_text = str(base64.encodebytes(encrypt), encoding='utf-8')  # Perform encryption and transcode back bytes
#     return encrypted_text
#
#
# def decrypt_aes(data, aes_key):
#     """
#     AES's ECB schema decryption
#     :param data: Data to be decrypted
#     :param aes_key: The encrypted key
#     :return: Decrypted data
#     """
#     # Initialize the cryptor
#     aes = AES.new(addStrToSpecifyLen(aes_key, 16), AES.MODE_ECB)
#     # Priority reverse decryption base64 into bytes
#     base64_decrypted = base64.decodebytes(addStrToSpecifyLen(data, 16))
#     # Perform decryption and transcode back to str
#     decrypted_text = str(aes.decrypt(base64_decrypted), encoding='utf-8').replace('\0', '')
#     return decrypted_text
